package Xuanke.entities;

public class Teacher extends Person {
    private Course taughtCourse;

    public Teacher(String id, String name, String gender) {
        super(id, name, gender);
    }

    public void openCourse(Course course) {
        this.taughtCourse = course;
        System.out.println("教师 " + getName() + " 开设课程：" + course.getCourseName());
    }

    public Course getTaughtCourse() {
        return taughtCourse;
    }

    public void printInfo() {
        super.printInfo();
        if (taughtCourse != null) {
            System.out.println("授课课程：" + taughtCourse.getCourseName());
        } else {
            System.out.println("暂未开设课程");
        }
    }
}